package com.markerhub.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.markerhub.entity.SysCollege;
import com.markerhub.entity.SysUser;
import com.markerhub.mapper.SysCollegeMapper;
import com.markerhub.service.SysCollegeService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author wang
 * @since 2022-03-31
 */
@Service
public class SysCollegeServiceImpl extends ServiceImpl<SysCollegeMapper, SysCollege> implements SysCollegeService {

    @Override
    public long getIdByCollege(String College) {
        return getOne(new QueryWrapper<SysCollege>().eq("college", College)).getId();
    }

    @Override
    public SysCollege getIdByColleg(String college) {

        return getOne(new QueryWrapper<SysCollege>().eq("college", college));
    }

    @Override
    public SysCollege getByCollegeNme(String oldName) {
        return getOne(new QueryWrapper<SysCollege>().eq("college", oldName));
    }

    @Override
    public SysCollege getObject(String college) {
        return getOne(new QueryWrapper<SysCollege>().eq("college", college));
    }

    @Override
    public String getCollegeNameById(Long college) {
        if(getOne(new QueryWrapper<SysCollege>().eq("id", college))==null){return null;}
        return getOne(new QueryWrapper<SysCollege>().eq("id", college)).getCollege();
    }
}
